<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <%@ include file="/WEB-INF/views/include/head.jsp"%>
    <script src="${ctxStatic}/js/jquery-1.9.1.min.js"></script>
    <script src="${ctxStatic}/js/DateTimePicker.js"></script>
    <script src="${ctxStatic}/js/layer.js"></script>
    <script src="${ctxStatic}/js/style.js"></script>
   	<script src="${ctxStatic}/dateCalendar/WdatePicker.js"></script>
    <link rel="stylesheet" href="${ctxStatic}/css/common_erp.css">
    <link rel="stylesheet" href="${ctxStatic}/css/list.css">
    <script>
 // 下拉选框带搜索功能
    $(document).ready(function() {
    	$("#inventoryCategory").select2();
    	searchListForm();
    });
	$(function(){
        $(".tabBox ul li").each(function(){
            var index=$(this).index();

            $(".tabBox ul li").eq(0).addClass("active");

            $(this).click(function(){

                $(this).addClass("active").siblings().removeClass("active");
                
                $("#tabPageStatus").val($(this).val());
                searchListForm();

                $(".tabBoxSm > .tabSm").eq(index).stop(true).show().siblings().stop(true).hide();
				
				var tableW = $(".tabBoxSm > .tabSm").eq(index).find('.tableHead').width();
				var tabodyH = $(".tabBoxSm > .tabSm").eq(index).find('.tableBody').height();
				var tableScrollH = $(".tabBoxSm > .tabSm").eq(index).find('.tableScroll').height();
				if(tabodyH>tableScrollH){
					$(".tabBoxSm > .tabSm").eq(index).find('.tableScroll').css('width',tableW + 18 + 'px')
				}else{
					$(".tabBoxSm > .tabSm").eq(index).find('.tableScroll').css('width','inherit')
				}

            })

        })

    });
        //检索 
    function searchListForm() {
    	var params = $("#searchForm").serialize();
    	$("#activity_pane").showLoading();
		$.post("${ctx}/material/inbound/searchList",params, function(result) {
			var listHtml = result["materialInbound"];
			var pageHtml = result["page"];
			$("#listHtml").html(listHtml);
			$("#paging").html(pageHtml);
			
			var length = $("p.needRED").length;
			for (var i = 0; i < length; i++) {
				var statusVal = $(".needRED")[i].innerHTML;
				if (statusVal=="<spring:message code="inventory_request_status_no" />") {
					$("p.needRED")[i].style.cssText="color:red;";
				}
			}
			$("#activity_pane").hideLoading();
		}, 'json');
	}
        
	//重置
	function clean() {
		$("#inventoryRequestNo").val("");
		$("#venderName").val("");
		$("#dateStart").val("");
		$("#dateEnd").val("");
		$("#inventoryCategory").val("");
		$("#inventoryCategory").select2();
		searchListForm();
	}   
    </script>
    
    <style type="text/css">
    

    
    </style>
</head>
<body>
<form id="searchForm">
<div class="listArea" id="activity_pane">
<c:set value="<%=ResourcesUtil.getConfig(\"inventory_category\")%>" var="inventorycategory" />
	<div class="listBg">
        <div class="searchArea clearfix">
            <div class="searchLeft clearfix">
                <div class="searchInp clearfix">
                <!-- 入库单号 -->
                    <p><spring:message code="inventory_Inbound_ID"/></p>
                    <input type="text" id="inventoryRequestNo" name="inventoryRequestNo"/>
                </div>
                <div class="searchInp clearfix">
                <!-- 入库类别 -->
                    <p><spring:message code="inventory_Inbound_Warehousingcategory"/></p>
                   <select class="width-125px" id="inventoryCategory" name="inventoryCategory">
                            <option value=""><spring:message code="material_pleaseChoosed"/></option>
	                       <c:forEach items="${fns:getDictList(inventorycategory)}"   var="category">
	                            <option value="${category.itemCode}-${category.itemValue}" > 
	                                ${category.itemName}
	                            </option>
	                        </c:forEach>
	                        </select>
                </div>
                <div class="searchInp clearfix">
                <!-- 客户/供应商名称 -->
                    <p style="width: 90px;"><spring:message code="inventory_customerSupplier_name"/></p>
                    <input type="text" id="venderName" name="venderName"/>
                </div>
                <div class="searchInp clearfix">
                <!-- 日期 -->
                    <p><spring:message code="inventory_Inbound_date"/></p>
                    <div class="timeBox">
							<input type="text" class="laydate-icon" onclick="WdatePicker({el:this,dateFmt:'yyyy-MM-dd',onpicked:null})"
								id="dateStart" name="dateFrom" style="width: 110px">
							<p class="list">~</p>
							<input type="text" class="laydate-icon" onclick="WdatePicker({el:this,dateFmt:'yyyy-MM-dd',onpicked:null})" 
								id="dateEnd" name="dateTo" style="width: 110px" >
                    </div> 
                </div>
                            
            </div>
            <div class="searchRight clearfix">
                <button type="button" onclick="searchListForm();"><spring:message code="commom_check" /></button>
                <button type="button" onclick="clean();"><spring:message code="common_reset" /></button>

                <%-- <button type="button" onclick="popup('1000px','650px','${ctx}/material/inbound/createbookorder')"><spring:message code="contract_create" /></button> --%>
			</div>

            </div>
        </div>
    <input type="hidden" id="tabPageStatus" name="tabPageStatus" value="0"/>
   
    <div class="tabBox">
        <ul class="clearfix">
            <!-- 全部 -->
            <li class="active" value="0"><spring:message code="inventory_request_list_tab_all"/></li>
            <!-- 待入库 -->
            <li value="1"><spring:message code="inventory_request_list_tab_wait"/></li>
            <!-- 已入库 -->
            <li value="2"><spring:message code="inventory_request_list_tab_done"/></li>
        </ul>
	</div>
   <div class="listBg tabPadding overflowX">
        <div class="tableArea tabBoxSm">
            <div class="tableScrollSm" style = "height:650px;overflow: auto;width: 1259px;">
                <table cellpadding="0" class="tableHead">
                    <thead>
                    <tr>
                    	<!-- No. -->
                        <th><p class="table-No"><spring:message code="inventory_request_list_no"/></p></th>
                        <!-- 入库申请单号 -->
                        <th><p class="width-150px"><spring:message code="inventory_request_list_requestNo"/></p></th>
                        <!-- 入库类别 -->
                        <th><p class="width-100px"><spring:message code="inventory_request_list_inventoryCategory"/></p></th>
                        <!-- 客户名称 -->
                        <th><p class="width-180px"><spring:message code="inventory_request_list_venderName"/></p></th>
                        <!-- 供应商名称 -->
                        <th><p class="width-150px"><spring:message code="inventory_request_list_supplierName"/></p></th>
                        <!-- 入库状态 -->
                        <th><p class="width-100px"><spring:message code="inventory_request_list_iventoryStatus"/></p></th>
                        <!-- 申请入库数量 -->
                        <th><p class="width-100px"><spring:message code="inventory_request_list_requestQuantity"/></p></th>
                        <!-- 已入库数量 -->
                        <th><p class="width-100px"><spring:message code="inventory_request_list_realQuantity"/></p></th>
                        <!-- 未入库数量 -->
                        <th><p class="width-100px"><spring:message code="inventory_request_list_residueQuantity"/></p></th>
                        <!-- 申请人员 -->
                        <th><p class="width-100px"><spring:message code="inventory_request_list_requestUser"/></p></th>
                        <!-- 申请日期 -->
                        <th><p class="width-100px"><spring:message code="inventory_request_list_requestDate"/></p></th>
                    </tr>
                    </thead>
                </table>
                <table cellpadding="0" class="tableBody">
                    <tbody id="listHtml">
                    <tr>
                        
                    </tr>
                    </tbody>
                </table>
            </div>
            
        </div>
    </div>
    <div id = "paging" ></div>   
<script type="text/javascript">
</script> 
</div>
 </form>
</body>
</html>
